#include <LengthUnit.h>

const unsigned int MAX_LENGTH_UNIT_INSTANCE_NUMBER = 3;

UnitMgr<LengthUnit>  LengthUnit::unitMgr(MAX_LENGTH_UNIT_INSTANCE_NUMBER);

const UnitAttribute volumeUnitAttributeTab[MAX_LENGTH_UNIT_INSTANCE_NUMBER] = 
{
//Name | Factor |M0 M1 /*M2 M3*/|
{"Mile", 1760*3, {1, 0/*, 0, 1*/}},//Mile
{"Yard", 3, 	 {1, 0/*, 1, 1*/}},//Yard
{"Feet", 1, 	 {1, 1/*, 1, 0*/}} //Feet
};

LengthUnit::LengthUnit(const UnitAttribute & unitPara)
:Unit(unitPara)
{
	unitMgr.storeUnit(this);
}

const  LengthUnit& LengthUnit::mile()
{
	static const  LengthUnit mile(volumeUnitAttributeTab[0]);
	return mile;
}
const LengthUnit& LengthUnit::yard()
{
	static  const LengthUnit  yard(volumeUnitAttributeTab[1]);
	return yard;
}

const LengthUnit& LengthUnit::feet()
{
	static  const LengthUnit feet(volumeUnitAttributeTab[2]);
	return feet;
}

void  LengthUnit::initUnitTab()
{
	feet();
	mile();
        yard();
	return; 
}
